Erase existing duplicates in eshell-history-ring
authorRobin Joy <emacs@robinjoy.net>
Fri, 24 May 2024 12:26:39 +0000 (14:26 +0200)
committerJim Porter <jporterbugs@gmail.com>
Sat, 25 May 2024 02:29:20 +0000 (19:29 -0700)
commit984fb346fdf0d5ec9eaea6126aad0bea8823b8a3
tree9dfe5d68c47ae5680f4811fb20a08c38407c94be
parentf3dd0d981cbb9c0fa10a3c5b05b244ed7a0f4e6b
Erase existing duplicates in eshell-history-ring

Erase all existing duplicates instead of just the last duplicate entry
when 'eshell-hist-ignoredups' is set to 'erase'.  Multiple duplicates
can exist in case 'eshell-hist-ignoredups' was set to something else
than 'erase' in the past or if the history file contains duplicates
(bug#71107).

* lisp/eshell/em-hist.el (eshell-add-input-to-history): Remove all
duplicates from history ring.

* test/lisp/eshell/em-hist-tests.el
(em-hist-test/add-to-history/erase-existing-dups): New test.
lisp/eshell/em-hist.el
test/lisp/eshell/em-hist-tests.el